using UnityEngine;
using UnityEngine.Audio;

namespace ZYFramework.AudioSystem
{
    /// <summary>
    /// 音频框架全局配置
    /// </summary>
    public class AudioConfig
    {
        /// <summary>
        /// 资源包名（YooAsset包名）
        /// </summary>
        public string ResourcePackageName = "DefaultPackage";

        /// <summary>
        /// BGM资源路径前缀（默认：Audio/BGM/）
        /// </summary>
        public string BGMPathPrefix = "Audio/BGM/";

        /// <summary>
        /// SFX资源路径前缀（默认：Audio/SFX/）
        /// </summary>
        public string SFXPathPrefix = "Audio/SFX/";

        /// <summary>
        /// AudioMixer资源引用（手动创建）
        /// </summary>
        public AudioMixer AudioMixer;

        /// <summary>
        /// BGM AudioMixer参数名称（默认：AudioMixer_BGM_Volume）
        /// </summary>
        public string BGMVolumeParameterName = "AudioMixer_BGM_Volume";

        /// <summary>
        /// SFX_2D AudioMixer参数名称（默认：AudioMixer_SFX_2D_Volume）
        /// </summary>
        public string SFX2DVolumeParameterName = "AudioMixer_SFX_2D_Volume";

        /// <summary>
        /// SFX_3D AudioMixer参数名称（默认：AudioMixer_SFX_3D_Volume）
        /// </summary>
        public string SFX3DVolumeParameterName = "AudioMixer_SFX_3D_Volume";

        #region 对象池配置

        /// <summary>
        /// 2D AudioSource初始池大小
        /// </summary>
        public int PoolInitSize_2D = 10;

        /// <summary>
        /// 2D AudioSource最大池大小
        /// </summary>
        public int PoolMaxSize_2D = 30;

        /// <summary>
        /// 2D AudioSource预热数量
        /// </summary>
        public int PoolPrewarmCount_2D = 5;

        /// <summary>
        /// 3D AudioSource初始池大小
        /// </summary>
        public int PoolInitSize_3D = 15;

        /// <summary>
        /// 3D AudioSource最大池大小
        /// </summary>
        public int PoolMaxSize_3D = 50;

        /// <summary>
        /// 3D AudioSource预热数量
        /// </summary>
        public int PoolPrewarmCount_3D = 10;

        /// <summary>
        /// 池空闲缩容延迟（秒）
        /// </summary>
        public float PoolShrinkDelay = 60f;

        #endregion

        #region 资源配置

        /// <summary>
        /// 是否预加载所有BGM
        /// </summary>
        public bool PreloadAllBGM = true;

        /// <summary>
        /// 音效资源缓存时间（秒，超时卸载）
        /// </summary>
        public float ResourceCacheTime = 300f;

        #endregion

        #region 播放配置

        /// <summary>
        /// BGM切换淡入淡出时间（秒）
        /// </summary>
        public float BGMFadeTime = 0.5f;

        /// <summary>
        /// 2D音效根节点名称（自动创建）
        /// </summary>
        public string Audio2DRootName = "Audio2DRoot";

        /// <summary>
        /// 3D音效根节点名称（自动创建）
        /// </summary>
        public string Audio3DRootName = "Audio3DRoot";

        #endregion
    }
}
